export class Message {
    constructor(role='user',content='') {
        this.role = role; // assistant为对话助手（模型）
        this.content = content;
        this.timestamp = ""; // YYYY-MM-dd
    }

    setRole(role) {
        this.role = role;
    }

    setContent(content) {
        console.log("content: ", content)
        this.content = content;
    }

    setTimestamp(timestamp) {
        this.timestamp = timestamp;
    }

    toJson() {
        return {
            role: this.role,
            content: this.content,
            timestamp: this.timestamp
        }
    }

    fromJson(json) {
        this.role = json.role;
        this.content = json.content;
        this.timestamp = json.timestamp;
    }
}